package com.tuyan.aixiang.api.helper;


/**
 * 异常处理
 */

public class ApiException extends Exception {
    private static final String TAG = "ApiException";
    private int code;
    private String displayMessage;


    public ApiException(int code, String displayMessage) {
        super(displayMessage); // use throwable.getMessage()
        this.code = code;
        this.displayMessage = displayMessage;
    }

    public ApiException(int code, String message, String displayMessage) {
        super(message);
//        Log.e(TAG, this);

        this.code = code;
        this.displayMessage = displayMessage;
    }

    public boolean isNetException() {
        if(CustomException.NETWORK_ERROR == this.code) {
            return true;
        }
        return false;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDisplayMessage() {
        return displayMessage;
    }

    public void setDisplayMessage(String displayMessage) {
        this.displayMessage = displayMessage;
    }


}
